var escape = require('escape-regexp');

var routers = {
};

var loginKey = escape("/x5/$v@build_version@_no_$lzh_CN$s/UI2/portal/login.w?manualLogin=true&bsessionid=") + "*";
var loginValue = "/x5/$v@build_version@_no_$lzh_CN$s/UI2/portal/login.w?manualLogin=true";
routers[loginKey] = loginValue;

var indexKey = escape("/x5/$v@build_version@_no_$lzh_CN$s/UI2/portal/index.w?process=/SA/OPM/system/systemProcess&activity=mainActivity");
var indexValue = "/x5/$v@build_version@_no_$lzh_CN$s/UI2/portal/index.w?process=/SA/OPM/system/systemProcess&activity=mainActivity";
routers[indexKey] = indexValue;

var Router = function(){
    var keys = [];
    for(var key in routers){
        keys.push({
            key:key,
            keyRegExp:new RegExp(key)
        });
    }
    routers.keys = keys;
};

Router.prototype.getRouter = function(url){
    for(var index in routers.keys){
          var keyItem = routers.keys[index];
          if(keyItem.keyRegExp.test(url)){
              return routers[keyItem.key];
          }
    }
    return null;
}
var router = new Router();
/*
debugger;
console.log(router.getRouter('/x5/$v@build_version@_no_$lzh_CN$s/UI2/portal/login.w?manualLogin=true&bsessionid=123456'));
*/
module.exports = router;




